home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16759 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.logicon.com!newsmaster@klee
  2. From: kkolda@logicon.com (Kenneth D. Kolda)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help Please
  5. Date: 11 Apr 1996 21:04:41 GMT
  6. Organization: Logicon Operating Systems
  7. Message-ID: <4kjs59$fhi@piper.logicon.com>
  8. References: <4ki39v$30s@daisy.flex.com.au>
  9. NNTP-Posting-Host: 137.51.122.161
  10. Mime-Version: 1.0
  11. X-Newsreader: WinVN 0.99.2
  12.  
  13. In article <4ki39v$30s@daisy.flex.com.au>, cobweb@flex.com.au says...
  14. [snip]
  15. >        printf("\n          4. Mars                  9. Pluto  " );
  16. >        printf("\n          5. Jupiter             10. The Moon");
  17. >
  18. >        printf("\n\nPlease select a number: ");
  19. >        scanf(" %c", &choice);
  20.  
  21. Make "choice" and int and then change this scanf to: 
  22.          scanf(" %d", &choice);
  23.  
  24. In your switch statement, change your cases to:
  25.  
  26.     case (1) : ...
  27.  
  28. etc.
  29.  
  30. As for weight and total, float should be sufficient.
  31. As for do...while or just while, 6 of one, half dozen ...
  32.  
  33. >        switch (choice)
  34. >     {  case ('1') :    total = (weight * .4);
  35. >                        printf("On Mercury you would weigh %.2f Pounds", 
  36.  
  37. Ken Kolda
  38.  
  39.